-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Formatted timestamps in the transcript should link! #5
Conversation
0c18057
to
7579cbf
Compare
let hasTimestamp = false; | ||
const children = React.Children.toArray(props.children).map((child, i) => { | ||
if (i === 0 && typeof child === "string") { | ||
const timestamp = child.match(/^\[(\d\d):(\d\d)(?::(\d\d))?\]/); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check all the p
tags, only check the first child in each one (since we are checking for [00:00:00]
Regex: https://regexr.com/
Also did some simple stuff to compute the number of seconds from the timestamp..
}); | ||
|
||
return ( | ||
<p id={hasTimestamp ? `playFrom=${hasTimestamp}` : ''}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess if we want it to move to the correct paragraph we need an id
?? It's covered by the player atm though so it would be nice to move the player to the bottom maybe?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the way heavybit does it, where there's no jump, and the player sticks to the top on scroll https://www.heavybit.com/library/podcasts/jamstack-radio/ep-42-structuring-content-with-simen-svale-skogsrud-and-knut-melvaer-of-sanity-io/
😱😱😱 Fixes hzoo/hopeinsource.com#5
Just me trying to get this working (although now I'm trying to test and noticing some weirdness like are the timestamps they put actually accurate..)
Also mobile view of the player (and now these links) aren't great!